package com.wkw.sdemo.utils;

import com.wkw.sdemo.domain.Result;
import com.wkw.sdemo.enums.ResultEnum;

public class ResultUtil {
    public static Result success(Object data){
        Result result = new Result();
        result.setReturnCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(data);
        return result;
    }

    public static Result success(){
        return success(null);
    }

    public static Result error(Integer code,String msg){
        Result result = new Result();
        result.setReturnCode(code);
        result.setMsg(msg);
        return result;
    }
}
